package com.heima.article.listen;

import com.alibaba.fastjson.JSON;
import com.heima.article.service.ApArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author jack
 * @data 2024 11:33
 */
@Component
public class ArticleListener {

    @Autowired
    private ApArticleService apArticleService;

    @KafkaListener(topics = "down_or_up_article")
    public void downOrUpArticle(String msg){
        Map map = JSON.parseObject(msg, Map.class);
        apArticleService.downOrUpArticle(map);
    }
}
